package charpter11.lynx;

import java.util.Stack;

public class Fifteen {
	public static void main(String[] args){
		Stack<Character> stack = new Stack<Character>();
		char test[] = "+U+n+c---+e+r+t---+a-+i-+n+t+y---+-+r+u--+l+e+s---".toCharArray();
		for (int i = 0; i < test.length; i++) {
			if (test[i] == '+'){
				stack.push(test[++i]);
			}else if (test[i] == '-'){
				System.out.print(stack.pop());
			}else{
				System.out.println("");
				System.out.println("Error parsing " + test[i]);
				break;
			}
		}
	}
}
